
package com.zyx.addressBook;

import java.lang.reflect.Type;
import java.util.List;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

public class CMJsonManager {
	private List<ContactMan> cList;
	private String cjson;
	
	
	public String getCjson() {
		return cjson;
	}

	public void setCjson(String cjson) {
		this.cjson = cjson;
	}

	public List<ContactMan> getcList() {
		return cList;
	}

	public void setcList(List<ContactMan> cList) {
		this.cList = cList;
	}
	
	public String CMListToJson()
	{
		Type listType = new TypeToken<List<ContactMan>>() {}.getType(); 
		Gson gson = new Gson(); 
		return gson.toJson(cList, listType); 
	}
	
	public List<ContactMan> CMListFromJson()
	{
		Type listType = new TypeToken<List<ContactMan>>() {}.getType(); 
		Gson gson = new Gson(); 
		return gson.fromJson(cjson, listType);
	}
}
